
/*
 * @constructor
 */
function NodeListTest() {
	
	var assert = new Assert();
	
	this.testConstructor = function() {
		nodeList = new NodeList(3,3);
		result = nodeList.searchByPosition(1, 1);
		assert.assertTrue(result==null, "Search should return null, returned "+result);
	};
	
	this.testSearchByPosition = function() {
		nodeList = new NodeList(3,3);
		nodeList.add(new Node(1,1,2,2));
		nodeList.add(new Node(2,1,3,3));
		nodeList.add(new Node(2,2,5,4));
		
		result = nodeList.searchByPosition(2, 1);
		assert.assertEquals(result.x, 2, "Result's x should be 2");
		assert.assertEquals(result.y, 1, "Result's y should be 1");
		
		expected = new Node(2,1,0,0);
		expectedHashCode = expected.hashCode();
		resultHashCode = result.hashCode();
		assert.assertTrue(expected.equals(result),"Result should be a node at (2,1) but  expected hashcode = "+(expectedHashCode)+" while result hashcode = "+(resultHashCode));		
	};
	
	this.testGetFirst = function() {
		nodeList = new NodeList(3,3);
		nodeList.add(new Node(1,1,2,2));
		nodeList.add(new Node(2,1,3,3));
		nodeList.add(new Node(2,2,5,4));
		
		result = nodeList.getFirst();
		assert.assertEquals(result.x, 1, "Result's x should be 1");
		assert.assertEquals(result.y, 1, "Result's y should be 1");	
		nodeList.remove(1, 1);
		result = nodeList.getFirst();
		assert.assertEquals(result.x, 2, "Result's x should be 2");
		assert.assertEquals(result.y, 1, "Result's y should be 1");
	};
}